package com.internetCafes.spms.web.sys.controller;


import com.internetCafes.spms.common.base.BaseWebController;
import com.internetCafes.spms.common.utils.entity.RR;
import com.internetCafes.spms.core.annotation.SysLog;
import com.internetCafes.spms.web.sys.bizservice.sms.SysSmsUserSendConfBizService;
import com.internetCafes.spms.web.sys.model.sms.req.SysSmsUserSendConfReq;
import com.internetCafes.spms.web.sys.model.sms.res.SysSmsUserSendConfFunctionCodeRes;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 管理系统 短信发送配置功能 前端控制器
 * </p>
 *
 * @author Zj
 * @since 2022-05-30
 */
@RestController
@RequestMapping("/sys/sms/send")
public class SysSmsUserSendConfController extends BaseWebController {

    @Autowired
    private SysSmsUserSendConfBizService smsSendConfBizService;

    /**
     * 获取短息发送功能编码列表
     */
    @GetMapping("/conf/function/code/list")
    public RR<List<SysSmsUserSendConfFunctionCodeRes>> listFunctionCode() {
        return RR.success(smsSendConfBizService.listFunctionCode());
    }

    @SysLog("配置信息表村")
    @PostMapping("/conf/save")
    @RequiresPermissions("sys:smsSendConf:save")
    public RR<Void> save(@RequestBody SysSmsUserSendConfReq req) {
        return smsSendConfBizService.saveConf(req) ? RR.success() : RR.fail();
    }

}
